import {createRouter,createWebHistory } from 'vue-router';

// 导入组件
import loginVue from '@/views/login.vue';
import layoutVue from '@/views/layout.vue';

import ArticleCategoryVue from '../views/article/ArticleCategory.vue'
import ArticleManageVue from '../views/article/ArticleManage.vue'
import UserAvatarVue from '../views/user/UserAvatar.vue'
import UserInfoVue from '../views/user/UserInfo.vue'
import UserResetPasswordVue from '../views/user/UserResetPassword.vue'

//定义路由关系
const routes = [
    {path:'/',component:loginVue},
    {path:'/layout',component:layoutVue,children:[ //redirect:'/article/category' 启动vue项目后默认的主页
        {path:'/article/category',component:ArticleCategoryVue},
        {path:'/article/manage',component:ArticleManageVue},
        {path:'/user/info',component:UserInfoVue},
        {path:'/user/avatar',component:UserAvatarVue},
        {path:'/user/resetPassword',component:UserResetPasswordVue}
    ]},
]

//创建路由器
const router = createRouter({
    history:createWebHistory(),//路由模式
    routes:routes,//路由
})

//导出路由
export default router